<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var regexp = new RegExp(/123/)
        var rg = /^123123$/
        console.log(rg.test('123123'));//true
        console.log(rg.test('4545'));//false
        console.log(rg.test('fd'));//false
        var rg1 = /123/
        console.log(rg1.test('123123'));//true
        console.log(rg1.test('123123123123'));//false
        console.log(rg1.test('fd'));//false
        //正则表达士只能使用1符号表达1
        var rg2 = /^[a-z]$/
        console.log(rg2.test('aa'));
        console.log(rg2.test('a'));
        //正则表达士只能使用1符号表达2
        var rg3 = /^[a-2A-2-z]$/
        console.log(rg3.test("abc"));
    </script>
</body>

</html>